<template>
  <el-form-item :rules="item.rule" :label="item.label" :prop="item.prop">
    <div class="el-input el-input-group el-input--suffix">
      <div class="el-input-group__prepend" v-if="item.prepend">
        {{ item.prepend }}
      </div>
      <el-input-number
        v-model="formData[item.prop]"
        @change="item.change && item.change(formData[item.prop])"
        :disabled="item.disabled"
        :max="item.max"
        :min="item.min"
        :placeholder="
          item.placeholder === undefined ? '请输入' : item.placeholder
        "
        :readonly="item.readonly === undefined ? false : item.readonly"
        :precision="item.precision === undefined ? 0 : item.precision"
        :controls-position="item.controlsPosition || ''"
        :controls="item.controls"
        :step="item.step || 1"
      >
      </el-input-number>
      <div class="el-input-group__append" v-if="item.append">
        {{ item.append }}
      </div>
      <div
        class="el-input-group__append transition"
        v-if="item.appendTwo"
        :style="{ width: item.appendTwoWidth ? item.appendTwoWidth : '95px' }"
      >
        {{ item.appendTwo }}
      </div>
    </div>
  </el-form-item>
</template>

<script>
export default {
  name: "inputNumberCom",
  props: {
    item: {
      type: Object,
      default: () => {
        return {};
      }
    },
    formData: {
      type: Object,
      default: () => {
        return {};
      }
    }
  }
};
</script>

<style scoped lang="scss">
::v-deep .transition {
  background-color: #fff;
  border-color: #fff;
  padding: 0 0px 0 10px;
}
</style>
